public class FindDirectories
{
   public static void main(String[] args) throws IOException{
	   findFile("D:\\java","Main.java");
   }
   public static void findFile(String path, String filename){
	   try{
		   File file = new File(path);
		   File lists[] = file.listFiles();
		   for(int i =0;i<lists.length;i++){
			   File curFile = lists[i];
			   if(curFile.isDirectory()){
				   findFile(curFile.getCanonicalPath().toString(),filename);
			   }
			   else{
				   if(curFile.getName().equals(filename)){
					   System.out.println(curFile);
				   }
			   }
		   }
	   }catch(IOException e){
		   e.printStackTrace();
	   } 	   
   }
}